package com.epoint.flinkdemo.map;

import com.epoint.flinkdemo.entity.SenSorReading;
import org.apache.flink.api.common.functions.MapFunction;

public class SensorReadingMapFunction implements MapFunction<String, SenSorReading> {

    public SensorReadingMapFunction() {}

    @Override
    public SenSorReading map(String s) throws Exception {
        String[] vars = s.split(",");
        return new SenSorReading(vars[0], Long.parseLong(vars[1]), Double.parseDouble(vars[2]));
    }
}
